<?php 
session_start();
include_once 'data/usercheck.php'; ?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Food Online</title>
	<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<div id="wrapper">
  <div id="logo">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  <table width="200" border="0" align="center">
    <tr>
      <td height="30"><FONT size="+6">
        <div align="center">STMS</div></td>
    </tr>
    <tr>
      <td><div align="center">STUDENT MANAGEMENT SYSTEM</div></td>
    </tr>
</table>
 
  <p>&nbsp;</p>
    </div>
   <div id="nav">
      <div id="nav-left">
        <ul>
          <li><a href="HometoAdmin.php">Home</a></li>
          <li class="orange">
            <div align="left"><a href="http://localhost/stms/pages/data/logout.php">Logout-<?php include_once 'data/databaseconnection.php';session_start();echo $_SESSION['username'];?></a></div></li>
        </ul>
      </div>
      <div id="nav-right">
      
        <ul>
         
          <li><a href="Aboutus.php">About us</a></li>
          <li><a href="viewhome.php">Student</a></li>
          <li><a href="Adminhome.php">Admin</a></li>
		  <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
      </div>
    </div>
    
    <div id="body"><a href="#"></a>
    <style type="text/css">
			div.scrollbar {
				height: auto;
				overflow: auto;
				border: solid 1px #000;
				padding: 5px;
				width:400px;
			}
		</style>
    <div align="right">
      <div align="left">
        <div align="left">
          <table width="751" border="0">
            <tr>
              <td width="96" height="23"><span class="clear"><font size="+1"><a href="showadmin.php">Basicdetails</a></font></span></td>
              <td width="84"><span class="clear"><font size="+1"><a href="aladmin.php">A/Ldetails</a></font></span></td>
              <td width="100"><span class="clear"><font size="+1"><a href="compinadmin.php">Combination</a></font></span></td>
              <td width="58"><span class="clear"><font size="+1"><a href="courseadmin.php">Course</a></font></span></td>
              <td width="51"><span class="clear"><font size="+1"><a href="Resultadmin.php">Result</a></font></span></td>
              <td width="335"><font size="+1"><a href="changepass.php"><span class="clear"><font size="+1"></font></span></a><span class="clear"><font size="+1"><a href="attendadmin.php">Attendance</a></font></span></font></td>
              <td width="207"><div align="right"><font size="+1"><a href="changepass.php">changepassword</a></font></div></td>
            </tr>
          </table>
        </div>
      </div>
    </div>
    <div class="clear">
<p>&nbsp;</p>
<p>
  <?php
        if (isset($_GET['err'])) {
            $err = $_GET['err'];
            echo '<span  style="color:  #F4C389"  >'.$err.'</span>';
			}
	
        if (isset($_GET['err1'])) {
            $err1 = $_GET['err1'];
			$delimiter = ".";
			$items = explode($delimiter, $err1);
			$a=$items[0];
			$b=$items[1];
			$sql=mysql_query("select * from combination where Regno='$a' and Level='$b'");
			while($row=mysql_fetch_array($sql))
			{
				$reg=$row['Regno'];
				$lev=$row['Level'];
				$cou1=$row['Course1'];
				$cou2=$row['Course2'];
				$cou3=$row['Course3'];
				$cou4=$row['Course4'];
				$cou5=$row['Course5'];
				$cou6=$row['Course6'];
			}
        }
		
		
		
		
		
		
        ?>
  <a href="down.php">download</a></p>
         <form id="insert" method="post" action="#">
          <p align="center">
            <label for="Regno">
              <div align="left">
        <p><font size="+1">
      Combination      </font>  </p>
        <p><font size="-1"><marquee direction="left">Regno and the Level is must for the changes</marquee></font></p>
        <table width="746" border="0">
          <tr>
            <td width="304" rowspan="2"><table width="304" border="0">
              <tr>
                <td><font size="-1">Regno</font></td>
                <td ><input type="text" name="Regno" id="textfield" value="<?php echo $reg; ?>" placeholder="2009/SP/004" pattern="[0-9]{4}/[A-Z]{2}/[0-9]{3}" /></td>
              </tr>
              <tr>
                <td><font size="-1">Level</font></td>
                <td><select name="Level" id="Level" onChange="javascript:this.form.submit();" >
				 <option value="1G"<?php if($_POST['Level'] =='1G') {?> selected="selected" <?php }?>>1G</option>
				<option value="2G"<?php if($_POST['Level'] =='2G') {?> selected="selected" <?php }?>>2G</option>
				<option value="3G"<?php if($_POST['Level'] =='3G') {?> selected="selected" <?php }?>>3G</option>
				
                  
                </select></td>
              </tr>
              <tr>
                <td>Combination</td>
                <td ><label for="Combination"></label>
                  <select name="Combination" id="Combination">
				   <option value="<?php  $name ?>"><?php  $name?></option>
				   <?php
				   
				 
				   $lev=$_POST['Level'];
				   
				   $result=mysql_query("SELECT * FROM combin WHERE Level='$lev' and Type='Main'");
				  ?>
            <?php while($row = mysql_fetch_array($result)){ ?>
            <option value="<?php echo $row['Subject']; ?>"<?php if($_POST['Subject'] == $row['Subject']) {?> selected="selected" <?php } ?>><?php echo $row['Subject'];?></option>
            
				  <?php } ?>
                  </select></td>
              </tr>
              <tr>
                <td>Elective</td>
                <td><label for="Elective"></label>
                  <select name="Elective" id="Elective">
				   <option value="<?php  $name ?>"><?php  $name?></option>
				   <?php
				   
				 
				   $lev=$_POST['Level'];
				   
				   $result=mysql_query("SELECT * FROM combin WHERE Level='$lev' and Type='Elective'");
				  ?>
            <?php while($row = mysql_fetch_array($result)){ ?>
            <option value="<?php echo $row['Subject']; ?>"<?php if($_POST['Subject'] == $row['Subject']) {?> selected="selected" <?php } ?>><?php echo $row['Subject'];?></option>
            
				  <?php } ?>
                  </select></td>
              </tr>
              <tr>
                <td>Auxilary</td>
                <td><label for="Auxilary"></label>
                  <select name="Auxilary" id="Auxilary">
				   <option value="<?php  $name ?>"><?php  $name?></option>
				   <?php
				   
				 
				   $lev=$_POST['Level'];
				   
				   $result=mysql_query("SELECT * FROM combin WHERE Level='$lev' and Type='Auxilary'");
				  ?>
            <?php while($row = mysql_fetch_array($result)){ ?>
            <option value="<?php echo $row['Subject']; ?>"<?php if($_POST['Subject'] == $row['Subject']) {?> selected="selected" <?php } ?>><?php echo $row['Subject'];?></option>
            
				  <?php } ?>
                  </select></td>
              </tr>
            </table></td>
            <td width="426"><label for="Search">Search</label>
            <input type="text" name="Searcher" id="Search"  /> <input type="submit" name="Search2" id="Search3" value="Search" /></td>
          </tr>
          <tr>
            <td><?php
			if(isset($_GET['err2'])) 
		{
		 $err2 = $_GET['err2'];
		 $result=mysql_query("SELECT * FROM combination WHERE Regno='$err2'");
			
			
			echo  "<div class=scrollbar >";
		  require_once 'data/databaseconnection.php';
			echo "<table border=1>";
			echo "<tr>";
			
			echo "<th>Regno</th>";
			echo "<th>Level</th>";
			echo "<th>Combination</th>";
			echo "<th>Elective1</th>";
			echo "<th>Elective2</th>";
			echo "<th>Elective3</th>";
			echo "<th>Auxilary1</th>";
			echo "<th>Auxilary2</th>";
			
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Level'];
				echo "<td>".$row['Main'];
				echo "<td>".$row['Elective1'];
				echo "<td>".$row['Elective2'];
				echo "<td>".$row['Elective3'];
				echo "<td>".$row['Auxilary1'];
				echo "<td>".$row['Auxilary2'];

			}
			echo "</table>";
			}
			else{
			echo  "<div class=scrollbar >";
		  require_once 'data/databaseconnection.php';
			echo "<table border=1>";
			echo "<tr>";
			
			echo "<th>Regno</th>";
			echo "<th>Level</th>";
			echo "<th>Combination</th>";
			echo "<th>Elective1</th>";
			echo "<th>Elective2</th>";
			echo "<th>Elective3</th>";
			echo "<th>Auxilary1</th>";
			echo "<th>Auxilary2</th>";
			$result=mysql_query("SELECT * FROM combination");
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Level'];
				echo "<td>".$row['Main'];
				echo "<td>".$row['Elective1'];
				echo "<td>".$row['Elective2'];
				echo "<td>".$row['Elective3'];
				echo "<td>".$row['Auxilary1'];
				echo "<td>".$row['Auxilary2'];
				
			}
			echo "</table>";
			}
			
			
			echo "</div>";
			
		  ?></td>
          </tr>
        </table>
		
		
		
		
		
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <table width="410" border="0">
          <tr>
            <td width="82"><div align="center">
              <input type="submit" name="Add" id="Add" value="Add" />
            </div></td>
            <td width="114"><div align="center">
              <input type="submit" name="Update" id="Update" value="Update" />
            </div></td>
            <td width="98"><input type="submit" name="Delete" id="Delete" value="Delete" /></td>
            <td width="98"><input type="submit" name="Search" id="Search2" value="Search" /></td>
          </tr>
        </table>
        <div align="left"></div>
      </form>
	  
	 
      <p>&nbsp;</p>
      </div>
      <div id="footer">
        <ul>
          <li><a href="HometoAdmin.php">Home</a> | </li>
          <li><a href="Aboutus.php">About Us</a> |  </li>
          
          <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
        <p>copyright &copy;STMS Group03</p>
      </div>
    </div>
  </div>
</body>
</html>
